﻿using RSFrame.Services;

namespace Microsoft.Extensions.DependencyInjection
{
    public static class CompanyServiceExtention
    {
        /// <summary>
        /// 注册汽车信息管理服务
        /// </summary>
        /// <param name="serviceDescriptors"></param>
        /// <param name="lifeScope">服务的生命周期</param>
        public static void AddCarService(this IServiceCollection serviceDescriptors, LifeScope lifeScope)
        {
            switch (lifeScope)
            {
                case LifeScope.Transient:
                    serviceDescriptors.AddTransient<ICarService, CarService.CarService>();
                    break;
                case LifeScope.Scoped:
                    serviceDescriptors.AddScoped<ICarService, CarService.CarService>();
                    break;
                case LifeScope.Singleton:
                    serviceDescriptors.AddSingleton<ICarService, CarService.CarService>();
                    break;
                default:
                    break;
            }
        }
    }
}
